<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>我的订单</title>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<script type="text/javascript">
var currentPage=${currentPage};
var totalPage = ${totalPage};
function getList(){
	location.href="BuyerOrderListServlet?currentPage="+currentPage;
}
function state(id,s){
	var info = "";
	if(s==0){
		info = "是否确定付款？";
	}else if(s==2){
		info = "是否确定收货？";
	}
	if(confirm(info)){
		location.href="BuyerOrderStateServlet?id="+id+"&state="+s;
	}
}
</script>
</head>
<body>
<jsp:include page="head.jsp"/>
<div id="container">
<table class="zebra" id="t">
<tr>
	<th>商品名称</th><th>价格</th><th>店名</th><th>老板</th><th>联系方式</th><th>数量</th><th>总价</th><th>状态</th><th>操作</th>
</tr>
<c:forEach items="${list}" var="s">
<tr>
	<td>${s.goods.goodsName }</td>
	<td>${s.goods.goodsPrice }</td>
	<td>${s.goods.user.userShopname}</td>
	<td>${s.goods.user.userNickname}</td>
	<td>${s.goods.user.userPhone}</td>
	<td>${s.goodsNum}</td>
	<td>${s.goodsNum*s.goods.goodsPrice}</td>
	<td>
		<c:choose>
			<c:when test="${s.orderState==0}">
				未付款
			</c:when>
			<c:when test="${s.orderState==1}">
				待发货
			</c:when>
			<c:when test="${s.orderState==2}">
				已发货
			</c:when>
			<c:when test="${s.orderState==3}">
				已完成
			</c:when>
		</c:choose>
	</td>
	<td>
		<c:if test="${s.orderState==0}">
			<input type="button" value="付款" onclick="state(${s.orderId},${s.orderState})">
		</c:if>
		<c:if test="${s.orderState==2}">
			<input type="button" value="确认收货" onclick="state(${s.orderId},${s.orderState})">
		</c:if>
	</td>
</tr>
</c:forEach>
</table>
<jsp:include page="page.jsp"/>
</div>
</body>
</html>